{% extends "basic/layout.html" %}

{% set bootstrap_version, navbar_version = "3.3.7", "" %}
  {% set bs_span_prefix = "col-md-" %}

<!-- <script src="https://use.fontawesome.com/3168e95f94.js"></script> -->
<!-- <script type="text/javascript" async
  src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=TeX-MML-AM_CHTML">
</script> -->

{% set script_files = script_files + [
    '_static/js/jquery-1.11.0.min.js',
    '_static/js/jquery-fix.js',
    '_static/bootstrap-' + bootstrap_version + '/js/bootstrap.min.js',
    '_static/bootstrap-sphinx.js',
    '_static/searchtools.js',
    'https://use.fontawesome.com/3168e95f94.js',
    'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=TeX-MML-AM_CHTML'
  ]
%}

{%- set render_sidebar = (not embedded) and (not theme_nosidebar|tobool) and sidebars %}

{%- set bs_content_width = render_sidebar and "9" or "12"%}

{%- block doctype -%}
<!DOCTYPE html>
{%- endblock %}

{% macro nav_bar() %}
{% include "navbar" + navbar_version + ".html" %}
{% endmacro %}

{%- macro bsidebar() %}
    {%- if render_sidebar %}
    <div class="{{ bs_span_prefix }}3">
      <div id="sidebar" class="bs-sidenav card" role="complementary" style="position: static !important;" >
        {%- for sidebartemplate in sidebars %}
          {%- include sidebartemplate %}
        {%- endfor %}
      </div>
    </div>
    {%- endif %}
{%- endmacro %}

{%- block extrahead %}
  <meta charset='utf-8'>
  <meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
  <meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
  <meta name="apple-mobile-web-app-capable" content="yes">
  <script type="text/javascript">
    jQuery(function() { Search.loadIndex("{{ pathto('searchindex.js', 1) }}"); });
  </script>
  {# this is used when loading the search index using $.ajax fails,
     such as on Chrome for documents on localhost #}
  <script type="text/javascript" id="searchindexloader"></script>
  {{ super() }}
{% endblock %}

{# Silence the sidebar's, relbar's #}
{% block header %}{% endblock %}
{% block relbar1 %}{% endblock %}
{% block relbar2 %}{% endblock %}
{% block sidebarsourcelink %}{% endblock %}

{%- block content %}
{{ nav_bar() }}
<div class="container">
  <div class="row">
    {%- block sidebar1 %}{{ bsidebar() }}{% endblock %}

    {# content_card is the variable which is assigned the placard css. It checks for the search page #}
    {% if pagename == "search" %}
      {%- set content_card = "no-card" %}
    {% else %}
      {%- set content_card = "content-padding card" %}
    {% endif %}

    {% if pagename != "search" and pagename != "index" and pagename != "tutorials" and pagename != "documentation" and pagename != "examples" and pagename != "guides" %}
    <div class="{{ bs_span_prefix }}3">
      <div id="sidebar" class="bs-sidenav card" role="complementary">
        <h3>Table of contents</h3>
        {{toc}}
      </div>
    </div>
    {%- set bs_content_width = "9" %}
    {% endif %}

    <div class="{{ bs_span_prefix }}{{ bs_content_width }}">
      <div class="{{content_card}}">
        <div>{% block body %}{% endblock %}</div>
      </div>
      {% if pagename == "tutorials" %}
        {# This is where the tutorials will be injected based on the filters #}
        <div id="search-results" class="tut-results"></div>
      {% endif %}
    </div>
  </div>
</div>
{%- endblock %}

{%- block footer %}
<footer class="footer">
  <div class="container">
    <p class="pull-right">
      <a href="#">Back to top</a>
      {% if theme_source_link_position == "footer" %}
        <br/>
        {% include "sourcelink.html" %}
      {% endif %}
    </p>
    <p>
    {% trans sphinx_version=sphinx_version|e %}Created using <a href="http://sphinx-doc.org/">Sphinx</a> {{ sphinx_version }}.{% endtrans %}
    {% trans copyright=copyright|e %}&copy; Copyright Astropy.{% endtrans %}
    </p>
  </div>
</footer>
{%- endblock %}
